﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>理化试验结果查看</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style>
        .easyui-linkbutton{margin-left:20px;}
        table tr td{padding:0px 5px}
    </style>
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
           <form id="searchForm" method="post">
	    	<table>
	    		<tr  class="divLabel">
                    <td>订单号:</td>
	    			<td>批次号:</td>
                    <td>零件号:</td>
                    <td>零件名称:</td>
                    <td>委托日期:</td>
	    		</tr>
	    		<tr >
                    <td><input class="easyui-textbox" type="text" name="txtMfgOrderName" style="width: 120px; height: 22px"/></td>
	    			<td><input class="easyui-textbox" type="text" name="txtContainerNO" style="width: 120px; height: 22px"/></td>
	    			<td><input class="easyui-textbox" type="text" name="txtProductName" style="width: 120px; height: 22px"/></td>
                    <td><input class="easyui-textbox" type="text" name="txtProductDesc" style="width: 120px; height: 22px"/></td>
	    			<td><input class="easyui-datebox" type="text" name="txtEntrustDate" style="width: 120px; height: 22px"/></td>
                    <td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchData()">查询</a></td>
	    			<td><a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.searchReset()">重置</a></td>
	    		</tr>
	    	</table>
	    </form>
        </div> 
    </div>

    <div class="panelSection">    
        <div class="easyui-panel " title="委托信息" style="padding:3px;width:100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
        <table id="MainTable" style="width: 100%; height: 320px" data-options="rownumbers:true,pagination:false,striped:true,checkOnSelect:true,selectOnCheck:true,singleSelect:false,pageNumber:1,pageSize:5,pageList:[5,10,20]"></table>
        <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
          </div>
        </div>
      </div>

    <div class="panelSection">
        <div class="easyui-panel " title="检测项信息" style="padding:3px;width:100%">
            <table id="DetailTable" style="width: 100%; height: 280px" data-options="rownumbers:true"></table>
        </div>
    </div>
    <div id="dialog"></div>
     <!--信息提示区域-->
    <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/dayjs.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
 /*
 创建人：longb
 日期：2023-06-09
 描述：理化试验结果js
 */
    var page = {
        pagetotal: 0,
        pageSize: 20,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ZsHandler/ZSEntrustMeteringHandler.ashx",
        QmsUrl: "http://localhost:80/ShowReprot/mes?",
        init: function () {
            page.bind();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        bind: function () {
            $("#MainTable").datagrid({
                checkOnSelect: false,
                selectOnCheck: false,
                singleSelect: true,
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pagetotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                onSelect: function (index, row) {
                    page.GetEntrustCheckPointData(row);
                },
                columns: [[
                 { field: 'MFGORDERNAME', title: '订单号', width: 100 },
                //{ field: 'ENGINENO', title: '发动机号', width: 100 },
                 {field: 'PRODUCTNAME', title: '零件号', width: 100 },
                 { field: 'PRODUCTDESC', title: '零件名称', width: 100 },
		         { field: 'BATCHNO', title: '批次号', width: 100 },
		         { field: 'FACTORYNAME', title: '委托单位', width: 100, align: 'center' },
                 { field: 'FULLNAME', title: '委托人', width: 70 },
                 { field: 'ENTRUSTQTY', title: '委托数量', width: 70 },
                 { field: 'ENTRUSTDATE', title: '委托日期', width: 90, align: 'center', formatter: function (value, row, index) { if (value != null) { return dayjs(value).format("YYYY-MM-DD"); } } },
                 { field: 'STATUS', title: '试验状态', width: 90, formatter: function (value, row, index) { if (value == "40") { return '任务结束'; } else { return '任务进行中'; } } },
                 { field: 'QMSENTRUSTNAME', title: '委托单号', width: 100 },
                 { field: 'IQSORDERQMSNOLH', title: '试验报告单号', width: 100 },
                 { field: 'FINISHREPORTTIME', title: '报告完成日期', width: 100, formatter: function (value, row, index) { if (value != null) { return dayjs(value).format("YYYY-MM-DD"); } } },
                 { field: 'TESTRESULT', title: '试验结果', width: 100 },
                 { field: 'SENDEMPLOYEENAME', title: '送样人', width: 70, hidden: true },
                 { field: 'SENDDATE', title: '送样时间', width: 110, hidden: true, formatter: function (value, row, index) { if (value != null) { return dayjs(value).format("YYYY-MM-DD"); } } },
	             { field: 'RECVEMPLOYEENAME', title: '取样人', width: 70, hidden: true },
                 { field: 'RECVDATE', title: '取样时间', width: 110, hidden: true, formatter: function (value, row, index) { if (value != null) { return dayjs(value).format("YYYY-MM-DD"); } } },
                 { field: 'TREATNOTE', title: '备注', width: 130 },
                 { field: 'REPORTURL', title: '理化报告详情', width: 90, formatter: function (value, row, index) {
                     if (value != null) {
                         //return '<a href="' + page.QmsUrl + value + '">查看</a>'; 
                         var url = page.ajaxUrl + "?action=DownloadFile&" + value;
                         return '<a href="' + url + '">查看</a>'
                     }
                 }
                 }
               ]],
                onDblClickRow: function (index, row) {
                    $('#dialog').dialog({
                        title:'调用接口返回结果',
                        content:row.RESXML,
                        width:600,
                        height:400
                    });
                }
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber;
                    page.GetEntrustMeteringData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = $(this).parents('tr').find('.pagination-num').val();
                page.pageNumber = pageNumber;
                page.GetEntrustMeteringData();
            });

            //理化检测项信息
            $("#DetailTable").datagrid({
                columns: [[
                 { field: 'DETAILNO', title: '顺序号', width: 50, align: 'center' },
                 { field: 'CHECKPOINTNOTE', title: '检测项目', width: 100 },
		         { field: 'CHECKPOINTNAME', title: '检测项内容', width: 150 },
		         { field: 'DRAWINGNO', title: '图纸序号', width: 100 },
                 { field: 'CHECKPOINTRESULTNOTE', title: '计量检测内容', width: 250 }
                ]]
            });

        },
        //查询
        searchData: function () {
            page.reset(false, true);
            page.pageNumber = 1;
            page.GetEntrustMeteringData();
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
        },
        GetEntrustMeteringData: function () {
            $('#DetailTable').datagrid('loadData', []);
            var frdata = $('#searchForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            var param = {
                action: "GetEntrustMeteringData",
                pageSize: page.pageSize,
                pageNumber: page.pageNumber,
                data: JSON.stringify(data)
            };
            page.post(param, function (res) {
                if (res.Result) {
                    page.pagetotal = res.RowCount;
                    $('#MainTable').datagrid('loadData', res.DBTable)
                }
            });

        },
        GetEntrustCheckPointData: function (row) {
            page.post({ action: 'GetEntrustCheckPointData', data: JSON.stringify({ EntrustMeasurementID: row.ENTRUSTMEASUREMENTID }) }, function (res) {
                $('#DetailTable').datagrid('loadData', res.DBTable)
            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: true,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    };
    $(function () {
        page.init();
    });
</script>
